<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>激活码</title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<script src="js/jquery-1.10.1.min.js"></script>
	<link rel="stylesheet" href="css/mui.min.css">
	<link rel="stylesheet" href="css/css.css">
</head>

<body class="bgfff">
<header class="mui-bar mui-bar-nav">
	<h1 class="mui-title">激活码</h1>
</header>
<div class="mui-content">
	<div class="page_top"><img src="images/logo.png" alt=""/></div>
	<div class="page_text">请输入激活码</div>
	<div class="tips">&nbsp;</div>
	<div class="code-container">
		<span class="tb-code"></span>
		<span class="tb-code"></span>
		<span class="tb-code"></span>
		<span class="tb-code"></span>
	</div>
	<div class="forget">忘记密码？<a>联系管理员</a></div>
	<input class="hdcode" type="number" pattern="[0-9]*"/>
</div>
<script>
	$('.hdcode').keydown(function(e){
		if (!(event.keyCode == 46) && !(event.keyCode == 8) && !(event.keyCode == 37) && !(event.keyCode == 39)) {
            if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105))) {
                event.returnValue = false;
            }
            if (e.value && e.value.length >= 4) {
                event.returnValue = false;
            }
        }
	})
	$('.hdcode').keyup(function(e){
		var value=$(this).val().substr(0, 4)
        var code = value
        for (var i = 0; i < 4; i++) {
            if (i < code.length) {
				$('.tb-code').eq(i).text(code[i])
            } else {
                
				$('.tb-code').eq(i).text('')
            }
        }
		if (code.length == 4) {
			if(code!='1234'){
				$('.tips').text('验证码是1234')
				$('.hdcode').val('')
				$('.tb-code').text('')
				$('.hdcode').focus();
			}else{
				window.location='index.html'
			}
			
        }
	})
	$('.code-container').click(function(){
		$('.hdcode').focus();
	})
</script>
</body>

</html>